package com.lykj.llw.box.adapter.agent

import android.view.View
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.lykj.llw.box.R
import com.lykj.llw.box.data.bean.response.agent.AgentMyVoucherResponse

/**
 * ================================================
 * 代理-我的代金券适配器
 * ================================================
 *
 * @author gosha
 * @date 2023/10/30-17:14
 */
class AgentVoucherAdapter :
    BaseQuickAdapter<AgentMyVoucherResponse.DataDTO, BaseViewHolder>(R.layout.item_agent_voucher) {
    override fun convert(holder: BaseViewHolder, item: AgentMyVoucherResponse.DataDTO) {
        holder.setText(R.id.tv_voucher, "${item.name}")
        holder.setText(R.id.tv_end_time,"领取后有效期：30天")
        holder.setText(R.id.tv_desc, "满${item.payMoney}元减${item.couponMoney}元")
//        holder.getView<TextView>(R.id.tv_end_time).visibility = View.GONE

        if (item.remainNumber == 0) {
            holder.getView<TextView>(R.id.tv_btn_send).visibility = View.GONE
        } else {
            holder.getView<TextView>(R.id.tv_btn_send).visibility = View.VISIBLE
        }
    }
}